package hk.m4s.lr.repair.test.ui.user;

import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;

import framework.common.Constant;
import framework.common.baseui.UeBaseActivity;
import framework.common.zanetwork.core.ResponseCallback;
import framework.utils.SharedPreferencesUtils;
import hk.m4s.lr.repair.test.R;
import hk.m4s.lr.repair.test.model.MyOrderModel;
import hk.m4s.lr.repair.test.ui.adapter.MyWaiteMoneyAdapter;
import hk.m4s.lr.repair.test.views.listview.VListView;
import okhttp3.Response;

/**
 * Created by qi.wang on 2017/3/23.
 * 待付款
 */

public class MyWaiteMoneyActivity extends UeBaseActivity  {
    /**
     * x下拉列表
     */
    private ListView vlist;
    private int pageNum = 1;
    private int pageSize = 10;
    private MyWaiteMoneyAdapter myOderAdapter;
    private String state = "";
    private List<MyOrderModel.ListBean> myjiangLiModelList = new ArrayList<>();
    private LinearLayout show_img;
    private TextView selct_price, selct_buy;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        baseSetContentView(R.layout.activity_my_waite_money);
        hiddenFooter();
        showGoBackBtn();
        String title = getIntent().getStringExtra("title");
        state = getIntent().getStringExtra("state");
        setTitleText("待付款");
        findBaseView();

    }

    public void findBaseView() {
        vlist = (ListView) findViewById(R.id.vlist);
        selct_price = (TextView) findViewById(R.id.selct_price);
        selct_buy = (TextView) findViewById(R.id.selct_buy);
        show_img = (LinearLayout) findViewById(R.id.show_img);
        myOderAdapter = new MyWaiteMoneyAdapter(MyWaiteMoneyActivity.this, myjiangLiModelList);
        vlist.setAdapter(myOderAdapter);
    }



    @Override
    protected void onResume() {
        super.onResume();
        //findOrderListByUser();
    }


    public static Double roundDouble(double val, int precision) {
        Double ret = null;
        try {
            double factor = Math.pow(10, precision);
            ret = Math.floor(val * factor + 0.5) / factor;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return ret;
    }

//    public void findOrderListByUser() {
//        Map<String, Object> parmas = new HashMap<>();
//        parmas.put("device_type", Constant.device_type);
//        parmas.put("token", SharedPreferencesUtils.getSharedPreferences(Constant.token, ""));
//        parmas.put("userId", SharedPreferencesUtils.getSharedPreferences(Constant.userId, ""));
//        parmas.put("status", state);
//        MyService.findOrderListByUser(MyWaiteMoneyActivity.this, parmas, new ResponseCallback<MyOrderModel>() {
//            @Override
//            public void onSuccess(MyOrderModel model) {
//                myjiangLiModelList.clear();
//                if (model.getList() != null) {
//                    show_img.setVisibility(View.GONE);
//                    myjiangLiModelList.addAll(model.getList());
//                }else{
//                    show_img.setVisibility(View.VISIBLE);
//                }
//                myOderAdapter.notifyDataSetChanged();
//
//            }
//
//            @Override
//            public void onError(Response response, int errorCode, String errorMsg, Exception e) {
//
//            }
//        });
//    }
}
